package com.dl.exam.service;

import com.alibaba.fastjson.JSONObject;
import com.dl.exam.entity.Page;
import com.dl.exam.entity.question.SingleQuestion;

import java.util.List;

/**
 * @author DL
 * @create 2022-01-24 19:40
 */
public interface SingleService {

    boolean addQuestion(SingleQuestion singleQuestion);

    boolean removeQuestion(String question_id);

    boolean modifyQuestion(JSONObject questionForm);

    SingleQuestion getQuestionById(String question_id);

    /**
     * 根据 用户id 查询用户的考试题目（未完成的考试）
     * @param examId 考试id
     * @return 考试信息
     */
    List<SingleQuestion> getUnfinishedQuestion(String examId);

    /**
     * 根据条件查询试题
     * @param jsonObject 条件
     * @return 带分页信息的单选题
     */
    List<SingleQuestion> getRandomQuestionByCondition(JSONObject jsonObject);

    /**
     * 查询所有单选题
     * @param currentPage 分页
     * @param pageSize 分页
     * @return 带分页信息的单选题
     */
    Page<SingleQuestion> getAllQuestion(Integer currentPage, Integer pageSize);

    /**
     * 根据条件查询试题
     * @param jsonObject 条件
     * @return 带分页信息的单选题
     */
    Page<SingleQuestion> getQuestionByCondition(JSONObject jsonObject);

    /**
     * 查询某场已完成的考试信息和答案
     * @param examId 考试id
     * @return
     */
    Page<SingleQuestion> getFinishedExamAnswer(String examId, Integer currentPage, Integer pageSize);
}
